#ifndef __H_STM32_HAL_SPI_H__
#define __H_STM32_HAL_SPI_H__

typedef enum
{
    h_stm32_hal_spi_ok = 0,
    h_stm32_hal_spi_error,
    h_stm32_hal_spi_busy,
    h_stm32_hal_spi_timeout,
}h_stm32_hal_spi_state;

extern h_stm32_hal_spi_state h_stm32_hal_spi1_init(void);
extern void h_stm32_hal_spi1_cs_enable(void);
extern void h_stm32_hal_spi1_cs_disable(void);
extern h_stm32_hal_spi_state h_stm32_hal_spi1_write(unsigned char *data, unsigned short len);
extern h_stm32_hal_spi_state h_stm32_hal_spi1_read(unsigned char *data, unsigned short len);

extern h_stm32_hal_spi_state h_stm32_hal_spi2_init(void);
extern void h_stm32_hal_spi2_cs_enable(void);
extern void h_stm32_hal_spi2_cs_disable(void);
extern h_stm32_hal_spi_state h_stm32_hal_spi2_write(unsigned char *data, unsigned short len);
extern h_stm32_hal_spi_state h_stm32_hal_spi2_read(unsigned char *data, unsigned short len);

extern h_stm32_hal_spi_state h_stm32_hal_spi_test(void);

#endif
